package gemini.basic.model;
// default package
// Generated Nov 23, 2010 4:23:01 PM by Hibernate Tools 3.4.0.Beta1

import static javax.persistence.GenerationType.IDENTITY;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.persistence.Version;

/**
 * Level generated by hbm2java
 */
@Entity
@Table(name = "g_level", catalog = "gemini", uniqueConstraints = @UniqueConstraint(columnNames = "name"))
public class Level extends AbstractDomain implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	
	private Integer id;
	private Integer version;
	private String name;
	private short discountScale;
	private String description;
	private Level level;
	private List<Level> levels = new ArrayList<Level>(0);
	private List<Distributor> distributors = new ArrayList<Distributor>(0);


	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Version
	@Column(name = "version")
	public Integer getVersion() {
		return this.version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	@Column(name = "name", unique = true, nullable = false, length = 20)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "discount_scale", nullable = false)
	public short getDiscountScale() {
		return this.discountScale;
	}

	public void setDiscountScale(short discountScale) {
		this.discountScale = discountScale;
	}

	@Column(name = "description", length = 100)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "level")
	public List<Distributor> getDistributors() {
		return this.distributors;
	}

	public void setDistributors(List<Distributor> distributors) {
		this.distributors = distributors;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "next_level_id")
	public Level getLevel() {
		return this.level;
	}

	public void setLevel(Level level) {
		this.level = level;
	}
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "level")
	public List<Level> getLevels() {
		return this.levels;
	}

	public void setLevels(List<Level> levels) {
		this.levels = levels;
	}
}
